<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::post('login', 'Api\UserController@login');  // 登录
Route::post('regis', 'Api\UserController@registe');  // 注册
Route::post('user/{user}/avatar', 'Api\UserController@updateAvatar');  // 上传头像
Route::post('user/{user}/cover', 'Api\UserController@updateCover');  // 上传封面
Route::post('user/{user}', 'Api\UserController@update');  // 更新用户信息
Route::get('user/{user}','Api\UserController@show');// 获取用户详情
Route::post('apply/{type?}', 'Api\UserController@apply');// 申请成为匠人
Route::get('craftsman/{cid}', 'Api\UserController@getCraftsman');// 获取匠人详情
Route::post('craftsman/{cid}', 'Api\UserController@updateShopName');// 获取匠人详情
Route::post('password/{user}','Api\UserController@reset');// 更改密码

Route::get('category', 'Api\CategoryController@index'); // 获取商品分类
Route::get('kind/{kind}', 'Api\CategoryController@getKindName'); // 获取分类名字
Route::post('goods', 'Api\GoodsController@updateOrCreate');  // 上传或更新商品
Route::patch('goods/{goods}', 'Api\GoodsController@switchStatus');  // 变更商品状态
Route::get('goods/{kind?}/{craftsman?}/{goods?}/{status?}/{sort?}/{min?}/{max?}/{key?}', 'Api\GoodsController@index');  // 获取商品列表
Route::delete('goods/{goods}', 'Api\GoodsController@destroy');  // 删除商品

Route::get('bid_goods/{cate_id?}/{craftsman?}/{item?}/{status?}/{sort?}/{key?}', 'Api\BidGoodsController@index');  // 获取拍卖品列表
Route::post('bid_goods', 'Api\BidGoodsController@updateOrCreate');  // 上传或更新拍卖品
Route::delete('bid_goods/{bid_goods}', 'Api\BidGoodsController@destroy');  // 删除拍卖品
Route::post('bid', 'Api\BidGoodsController@bid');  // 竞价

Route::get('order/{type?}/{cid?}/{uid?}', 'Api\OrderController@index'); // 获取订单列表
Route::get('goods_order/{order_id}', 'Api\OrderController@showGoodsOrder'); // 获取普通商品订单详情
Route::post('order', 'Api\OrderController@create');  // 创建普通商品订单
Route::get('pay/{order_id}','Api\OrderController@pay');  // 支付

Route::get('zone', 'Api\ZoneController@index');  // 获取交流圈列表
Route::post('blog', 'Api\BlogController@updateOrCreate');  // 上传或更新帖子
Route::post('blog/{uid?}', 'Api\BlogController@upload');  // 上传帖子图片
Route::get('blog/{type?}/{zid?}/{cid?}/{blog_id?}', 'Api\BlogController@index');  // 获取帖子列表
Route::delete('blog/{id}', 'Api\BlogController@delete');  // 删除帖子

Route::post('note', 'Api\NoteController@updateOrCreate');  // 上传或更新手记
Route::get('note/{uid?}/{zid?}', 'Api\NoteController@index');  // 获取手记列表
Route::post('note/{uid}', 'Api\NoteController@upload');  // 上传手记图片
Route::post('del_img', 'Api\NoteController@deleteImg');  // 删除手记图片
Route::delete('note/{note}', 'Api\NoteController@destroy');  // 删除手记

Route::get('note_comment/{note?}/{user?}', 'Api\NoteController@commentIndex');  // 获取手记评论列表
Route::post('note_comment', 'Api\NoteController@addComment');  // 添加手记评论
Route::delete('note_comment/{comment}', 'Api\NoteController@delComment');  // 删除手记评论
